function checkbox_check(id) {
	var boxes = document.getElementsByName("myCheckbox");
	for ( var i = 0; i < boxes.length; i++) {
		if (boxes[i].id == id) {
			boxes[i].checked = true;
			document.getElementById("id").value = id;
		} else {
			boxes[i].checked = false;
		}
	}

	// alert(id);
}

function myForm1_submit(id) {
	var QiYeID = document.getElementById("id").value;
	if (QiYeID == "") {
		alert("请选择要查看的项目");
	} else {
		if (id == "XiangMuSP") {
			alert("跳转到项目id为" + QiYeID + "的项目审批页面");
		}
		if (id == "CanJianQY") {
			myForm1.action="listCanJianQY?GongChengXMID=" + QiYeID;
			myForm1.submit();
		}
		if (id == "ZhengDiCQ") {
			alert("跳转到项目id为" + QiYeID + "的征地拆迁页面");
		}
		if (id == "ZhongDaSJBG") {
			alert("跳转到项目id为" + QiYeID + "的重大设计变更页面");
		}
		if (id == "BiaoDuan") {
			alert("跳转到项目id为" + QiYeID + "的标段页面");
		}
	}
}

function GongCheng_Insert() {
	myForm1.action = "GongChengXM_Insert.jsp";
	
	myForm1.submit();
}

function GongCheng_Update() {
	var GongChengID = document.getElementById("id").value;
	myForm1.action = "viewGongCheng?id=" + GongChengID + "&viewOrUpdate=update";
	
	myForm1.submit();
}

function GongCheng_Delete() {
	var GongChengID = document.getElementById("id").value;
	if (GongChengID == "") {
		alert("请选择要删除的项目");
	} else {
		if (window.confirm("确定删除？")) {
			myForm1.action = "deleteGongCheng?ID=" + GongChengID;
			
			myForm1.submit();
			
			var tr = document.getElementById("tr" + GongChengID);
			var tbody = document.getElementById("myForm2_table").lastChild;
			tbody.removeChild(tr);
		}
	}
}

function homePage() {
	var pageSize = document.getElementById("pageSize").value;
	myForm2.action="listGongCheng?pageSize=" + pageSize + "&pageNum=1";
	myForm2.submit();
}
function prePage() {
	var pageSize = document.getElementById("pageSize").value;
	var currentPage = document.getElementById("currentPage").value;
	if (currentPage <= 1) {
		currentPage = (1 + 1);
	}
	myForm2.action="listGongCheng?pageSize=" + pageSize + "&pageNum=" + (parseInt(currentPage)-parseInt('1'));
	myForm2.submit();
}
function nextPage() {
	var pageSize = document.getElementById("pageSize").value;
	var currentPage = document.getElementById("currentPage").value;
	var totalPage = document.getElementById("totalPage").value;
	if (currentPage >= totalPage ) {
		currentPage = (parseInt(totalPage) - parseInt('1'));
	}
	myForm2.action="listGongCheng?pageSize=" + pageSize + "&pageNum=" + (parseInt(currentPage)+parseInt('1'));
	myForm2.submit();
}
function endPage() {
	var pageSize = document.getElementById("pageSize").value;
	var totalPage = document.getElementById("totalPage").value;
	myForm2.action="listGongCheng?pageSize=" + pageSize + "&pageNum=" + totalPage;
	myForm2.submit();
	
}
function setDate() {
	var JILUSJ = document.getElementById("JILUSJ").value;
	var JIHUAKGRQ = document.getElementById("JIHUAKGRQ").value;
	var JIHUAJGRQ = document.getElementById("JIHUAJGRQ").value;
	var SHIJIKGRQ = document.getElementById("SHIJIKGRQ").value;
	var SHIJIJGRQ = document.getElementById("SHIJIJGRQ").value;
	document.getElementById("DS_JiLuSJ").value = JILUSJ;
	document.getElementById("DS_JiHuaKGRQ").value = JIHUAKGRQ;
	document.getElementById("DS_JiHuaJGRQ").value = JIHUAJGRQ;
	document.getElementById("DS_ShiJiKGRQ").value = SHIJIKGRQ;
	document.getElementById("DS_ShiJiJGRQ").value = SHIJIJGRQ;
}
